package host.haiwai.mapstruct;

import host.haiwai.entity.Admin;
import host.haiwai.vo.AdminVo;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * Mapstruct 转换pojo转vo工具类
 */
@Mapper
public interface AdminMapstruct {
    AdminMapstruct mapper = Mappers.getMapper(AdminMapstruct.class);

    @Mappings({
            @Mapping(source = "username",target = "username"),
            @Mapping(source = "adminId",target = "adminId"),
            @Mapping(source = "roleId",target = "roleId"),
            @Mapping(source = "roleName",target = "roleName")
    })
    AdminVo adminPojo2Vo(Admin admin);

    List<AdminVo> adminList2Vo(List<Admin> list);
}
